﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" class="panel-fit">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title></title>
    <link href="~/Content/jquery-easyui-1.9.4/themes/metro/easyui.css" rel="stylesheet" />
    <link href="~/Content/scripts/jquery-easyui-extensions/datagrid/datagrid.css" rel="stylesheet" />
    <link href="~/Content/layui/css/layui.css" rel="stylesheet" />
    <link href="~/Content/layui/css/layui_extension.css" rel="stylesheet" />
    <link href="~/Content/jquery-easyui-1.9.4/themes/icon.css" rel="stylesheet" />
    <link href="~/Content/960css/960.css" rel="stylesheet" />
    <link href="~/Content/scripts/jquery-plugin/showloading/showLoading.css" rel="stylesheet" />
    <style type="text/css">
        .list-b li {
            margin-left: 2px;
            padding-left: 18px;
            line-height: 18px;
            height: 18px;
            overflow: hidden;
            font-size: 12px;
            background: url('/Content/icon/icon/arrow_right_16.png') no-repeat;
        }

        .list-b a:link {
            color: #666;
            text-decoration: none;
        }

        .list-b a:visited {
            color: #666;
            text-decoration: none;
        }

        .list-b a:hover, .list-b a:active {
            color: #ff8400;
            text-decoration: underline;
            cursor: pointer;
        }
    </style>
    <script src="~/Content/jquery-easyui-1.9.4/jquery.min.js"></script>
    <script src="~/Content/jquery-easyui-1.9.4/jquery.easyui.min.js"></script>
    <script type="text/javascript">
        var Desk = {
            rowCount: 0,
        };
        $(function () {
            Desk.AdjustWidth();
            Desk.AuditFirstLoad();
            //Desk.GetWaitDealList();
            //先注释每隔30秒发送ajax
            //Desk.clickWaitDealList = setInterval(Desk.GetWaitDealList, 30000);
            Desk.clickAuditList = setInterval(Desk.GetAuditList, 30000);
            $("#p1 a").each(function () {
                $(this).click(function () {
                    top.wrapper.addTab($(this).attr("alt"), $(this).attr("url"));
                });
            });
        });
    </script>
    <script type="text/javascript">
        Desk.AdjustWidth = function () {
            var auditWidth = $("#divAuditList").width();
            var waitWidth = $("#p3").width();
            var contentWidth = $("#content").width();
            var contentHeight = $("#content").height();
           /// console.log($("#content"));

           // console.log(contentHeight);
            var p1Width = contentWidth - auditWidth - waitWidth - 35;
            var allHeight = contentHeight - 15;
           // console.log(allHeight);
            $("#tbList").height(allHeight);
            $("#p1").panel({
                title: '快速导航菜单',
                width: p1Width,
                height: allHeight,
                closed: false,
                cache: false,
                collapsible: true, minimizable: false,
            });
            $("#p3").panel({
                title: '待办事宜',
                height: allHeight,
                closed: false,
                cache: false,
                collapsible: true, minimizable: false,
            });
        }
        Desk.AuditFirstLoad = function () {
            $.ajax({
                url: "/Audit/GetMyReviewTask",
                type: "post",
                dataType: "json",
                success: function (data) {
                  //  console.log(data);
                    rowCount = data.length;
                    $("#tbList").datagrid({
                        data: data,
                        loadMsg: '数据加载中请稍后……',
                        rownumbers: true,
                        idField: "ID",
                        singleSelect: false,
                        striped: true,
                        columns: [[
                         { field: 'RevNum', title: '审批单号 ', align: "center", width: 120 },
                         { field: 'DocName', title: '审批类型 ', align: "center", width: 120 },
                         { field: 'FillDate', title: '制单时间 ', align: "center", width: 80 },
                         { field: 'AddPerson', title: '制单人 ', align: "center", width: 80 },
                         { field: 'CurrentReviewName', title: '当前审核人', align: "center", width: 120 }]],
                        onDblClickRow: function (rowIndex, rowData) {
                            var url = rowData.TotalUrl + "?action=review&reviewId=" + rowData.ID;
                            top.wrapper.addTab("我的审批任务", url);
                        }
                    });

                }
            });
        }
        //Desk.GetWaitDealList = function () {
        //    $.ajax({
        //        url: "/Logic/BD/WaitDealAjax.aspx?method=GetPersonWaitList",
        //        type: "post",
        //        dataType: "json",
        //        success: function (data) {
        //            $("#ulWaitDeal").html("");
        //            for (var i = 0; i < data.length; i++) {
        //                var wait = data[i];
        //                var sign = "";
        //                if (wait.count != "0") {
        //                    sign = "<font color='red'>(" + wait.count + ")</font>";
        //                }
        //                var li = "<li><a url='" + data[i].LinkUrl + "' title='" + data[i].Name + "' alt='" + data[i].PermName + "'>" + data[i].Name + sign + "</a></li>";
        //                $("#ulWaitDeal").append(li);


        //            }

        //            $("#p3 a").each(function () {
        //                $(this).click(function () {
        //                    top.wrapper.addTab($(this).attr("alt"), $(this).attr("url"));
        //                });
        //            });
        //        },
        //        error: function () {
        //            $("#ulWaitDeal").html("待办事宜出错啦，请联系管理员！！！");
        //        }
        //    });
        //}
        Desk.GetAuditList = function () {
            $.ajax({
                url: "/Audit/GetMyReviewTask",
                type: "post",
                dataType: "json",
                success: function (data) {
                    if (data.length != rowCount) {
                        rowCount = data.length;
                        $("#tbList").datagrid({
                            data: data,
                            loadMsg: '数据加载中请稍后……',
                            rownumbers: true,
                            idField: "ID",
                            singleSelect: false,
                            striped: true,
                            columns: [[
                             { field: 'RevNum', title: '审批单号 ', align: "center", width: 120 },
                             { field: 'DocName', title: '审批类型 ', align: "center", width: 120 },
                             { field: 'FillDate', title: '制单时间 ', align: "center", width: 80 },
                             { field: 'AddPerson', title: '制单人 ', align: "center", width: 80 },
                             { field: 'CurrentReviewName', title: '当前审核人', align: "center", width: 120 }]],
                            onDblClickRow: function (rowIndex, rowData) {
                                var url = rowData.TotalUrl + "?action=review&reviewId=" + rowData.ID + "&ID=" + rowData.SrcID;
                                top.wrapper.addTab("我的审批任务", url);
                            }
                        });
                    }
                }
            });
        }
    </script>
</head>
<body>
    <div id="content" style="width: 100%; height: 100%">
        <div style="float: left;width:580px" id="divAuditList">
            <table id="tbList" title="我的待审任务 " style="width: 580px; height: 100%;"></table>
        </div>
        @*<%--        <div style="float: left; margin-left: 10px; margin-right: 5px;">
                <div id="p1" style="background: #fafafa; float: left;">
                    <%for (int i = 0; i < perm.Count; i++)
                    {
                    %>
                    <div style="float: left; width: 60px; height: 75px; margin-left: 10px; margin-top: 5px; text-align: center">
                        <a url="<%=perm[i].LinkUrl %>" style="cursor: pointer" alt="<%=perm[i].Name %>">
                            <img src="/Images/mms/<%=perm[i].ShortCutPic %>" /><div><%=perm[i].Name %></div>
                            <div class="clear"></div>

                        </a>

                    </div>

                    <%
                    } %>
                </div>

            </div>
            <div style="float: right; margin-left: 5px">
                <div id="p3"
                     style="width: 160px; background: #fafafa;">
                    <ul id="ulWaitDeal" class="list-b" style="margin: 0; padding: 0; margin-top: 5px"></ul>

                </div>
            </div>--%>*@
    </div>
</body>
</html>